home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1998 September
/
Macworld (1998-09).dmg
/
Shareware World
/
Info
/
For Developers
/
MacZoop 1.8.3
/
Required Classes
/
Z Headers
/
ZCommander.h
< prev
next >
Wrap
Text File
|
1998-06-11
|
2KB
|
94 lines
/*************************************************************************************************
*
*
* MacZoop - "the framework for the rest of us"
*
*
*
* ZCommander.h -- an object for handling commands
*
*
*
*
*
* © 1996, Graham Cox
*
*
*
*
*************************************************************************************************/
#pragma once
#ifndef __ZCOMMANDER__
#define __ZCOMMANDER__
#ifndef __ZCOMRADE__
#include "ZComrade.h"
#endif
#ifndef __ZOBJECTARRAY__
#include "ZObjectArray.h"
#endif
class ZCommander;
// set up streaming stuff:
DEFINECLASSID( ZCommander, 'zcmd' );
typedef ZObjectArray<ZCommander> ZCommanderList;
// class def:
class ZCommander : public ZComrade
{
protected:
ZCommander* itsBoss;
ZCommanderList* itsUnderlings;
public:
ZCommander( ZCommander* aBoss );
ZCommander();
virtual ~ZCommander();
virtual void HandleCommand( const short menuID, const short itemID);
virtual void HandleCommand( const long theCommand );
virtual void UpdateMenus();
virtual void HandleAppleEvent( AEEventClass aeClass, AEEventID aeID,
AppleEvent* aeEvt, AppleEvent* reply );
virtual void Idle();
virtual void Type( const char theKey, const short modifiers );
virtual void SendMessage( long aMessage, void* msgData );
virtual void SendMessage( ZMessage* aMessage );
virtual void DoCut() { DoCopy(); DoClear(); };
virtual void DoCopy() {};
virtual void DoPaste() {};
virtual void DoClear() {};
virtual void DoSelectAll() {};
virtual Boolean CanPasteType() { return FALSE; };
virtual ZCommander* GetHandler() { return this; };
inline ZCommander* GetBoss(){ return itsBoss; };
inline ZCommanderList* GetUnderlings() { return itsUnderlings; };
// streaming:
virtual void WriteToStream( ZStream* aStream );
virtual void ReadFromStream( ZStream* aStream );
protected:
virtual void AddUnderling( ZCommander* anUnderling );
virtual void RemoveUnderling( ZCommander* anUnderling );
};
// windows and the application are derived from this. It implements a single entity in the
// "chain of command". You can subclass this to make any object that can handle commands,
// though more usually you will subclass windows.
#endif